package com.fuluwa.interfaces.usercenter.facade;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.fuluwa.domain.security.model.Role;
import com.fuluwa.domain.security.model.User;
import com.fuluwa.domain.usercenter.model.UserProfile;
import com.google.common.collect.Lists;

public class UserDTO {

	private String loginName;
	private String password;

	private String username;
	// private String newPassword;
	private String email;
	private List<Role> roleList = Lists.newArrayList();

	private String channelId;
	private String channelType;
//	private String nickName;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public List<Role> getRoleList() {
		return roleList;
	}

	public void setRoleList(List<Role> roleList) {
		this.roleList = roleList;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getChannelId() {
		return channelId;
	}

	public void setChannelId(String channelId) {
		this.channelId = channelId;
	}

	public String getChannelType() {
		return channelType;
	}

	public void setChannelType(String channelType) {
		this.channelType = channelType;
	}

	public User toUser() {
		if(StringUtils.isBlank(username)) {
			username=loginName;
		}
		email=loginName;
//		UserAttribute attribute = new UserAttribute(username, email, channelId, channelType);
		return new User(loginName, password, email, roleList);
	}
}
